package exercises.examples.ch6;

public class Main {
    static final String NAME ="wang";
    public static void main(String[] args) {
        Student student1,student2;
        student2=new Student(NAME);
        student1=new Student("wang");
        System.out.println(student1.equals(student2));
        System.out.println(student1);
    }
}
class Student{
    public boolean equals(@org.jetbrains.annotations.NotNull Student student) {
        return student.name.equals(this.name);
    }

    @Override
    public String toString() {
        return "StuName:"+this.name;
    }
    public void setName(String name){
        this.name=name;
    }
    private String name;
    Student(String name){
        this.setName(name);
    }
}